package com.itany.book.conf;

import com.alipay.api.DefaultAlipayClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlipayConfig {

    // 修改appId, privateKey, alipayPublicKey这个公钥是根据自己的公钥在支付宝沙箱上生成的支付宝公钥！
    @Bean(name = "alipayClient")
    public DefaultAlipayClient alipayClient() {
        DefaultAlipayClient alipayClient =
                new DefaultAlipayClient("https://openapi.alipaydev.com/gateway.do"
                        , "2016101500691378"
                        , "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCas/39ywz9hH3piq0cdFdKR74+9Rg1RNsrSNykbDMvQkszlensjVnYwXNUJ99d4Mf/2rsft6AL9tLUUWKNiQrweozCUiesZohQIJgnkgcekU2Jq/7VcK/8+CQLehjTUlZlE67aewCvwHsZH7z2XYThK15dxvtWK7Qg4CgHgokDR7XWvDzlMQZSQ83dD+rQH7KbzeWIB0h0VXDo7wHpyr6GW3+qbE8/iQG1VUgKQeq1gJ8TiyreGAaPtebcCwXWzXprJakb1E2oP1V/0vdIl3AixbVca+k3VGTugkTHS5MLMAD6Zuoa4mY/EfsXM5I8bAhfwP/mpsCeSx9/KoJcf6V3AgMBAAECggEAKDbZs3tw6QXj5S2TSm5Dsp9rqNn1bQN1JY9PK76kn4hQHBzALimgTWQcIqgqvDCOTMgDFH+bLwD+VQrC35/cJB73MBxDC+GrVYjjhIXFLAEBcuQu3jToyo2GcSVQBr7EjonLTifjScxzM1i4uiIdRJsNcLsk4oWB0XnzbeBU1XEKOJwFg2Lcg7X1pB47wvIrKco0dhE5LYEBK7Vl8dNnZXG56zH3b3Flgnd9OiwM27n0/WV8Ml4ELfnBuUI1oc5z0cjuJuc3vXTuY+10SAKXNxyNnR1/ri09YhNxdvOxZtla45YRig/tvlGMACAEjUgafwqtHzDGJqT48SowevaLwQKBgQDkMus15O3tIcAb7iZgwBT5kbIWGXR7CUObVwP7jNpVvWWKjdzP9JIGF0Q7rmQkWRupwBB2nqc8XC1xR+8WNFbYs2g/i3sUIht1orRDwTz+GbOxvMV2k8tmw1w9KdHHW/jLnyHkhGRRB5b2akzUvmCP4AzdJe7TKUvQlU4PyKmqmQKBgQCtjOG0mhKnID+DI1QNcOgwaiQC4Vq7pTivFxQsixTvxlv4Z1Ysvkyuvcnijw8jWfKfQtoxGCgkH3zsToFLersR/vTkm4IO9RbkuDdIRicvWZ5a/t/mK9ikf2hV9cHMumoYAnnHnVKgsZIQnJyd6oeoPMkrzRJ9fAsJGJP+IYZqjwKBgQChQt53Go2MuwIQes5CJttrtiscdOacn+JX3zkgRdxxJMOiEzhM+O9MQJrmdgmsqg/jeKfpu5pBDH7Mg+IQVfJddwMfjMjwZF31VoJ/MwqQIseaveTpM+5Uc5A2ZNwrPvJlqtH/tBNUM8HZ5yreWJ7SbamJimnobVF3WFtuygYkWQKBgAY/5IDUa4eJKcBXLVeukS3tJI7V/qZzNK9ZbWiNOZvI0NcJIZlK4QgJ3ZNDA5CKVKpXhfPuosNqPt1jllRZfxMO01LIJs7TFJf36kW4AQE7gPBV7UokmhCSZfdyeiAdNmTW8fu2NpuCyXe/rAQjxe7RAY2KPPg3103kjK/CFU0RAoGAdfyIWGBWrle/9U8kEh+MatoxyKZV1w1ZXQhTsFPGcYu09RbYXTOUDKEUor0mpw3qE6ruJKap/Aiaz1eYnmlq2fPp9L7jQinc1oGzvZNfZe67/UK/Kkxi/JWf/JskVZVTbbQdOpI7VjXKhg8WWsFwXYoIGhBGXbLcRJHtWKXIULc="
                        , "json"
                        , "utf-8"
                        , "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAi4swvi5w0nQBGGk0foTpCiLovuqdZyI1apaYnxXuNluCrB61IT8QkpQD4V/qUZ2EAIDJYgJQ6hBg1RChUMcsRiz5jBo1ypERdZ/XM2VmAgU2a5WU3wiefuJ/mkNXHYK6WOYVMk9ct125uBQ7Q3OiYurSXj854CyO/Sod+ITBONOTg4AhX9Uv+NVoQ0S/YBdZ0QJL0K7VowGgGHFjrjVkFGQ6ZxZKOx/GBgvbmb3nQn3bXA6Rw9sF/wqVcXNmalB6pOb1KKqIoDMcr7Nrtjwm9sht/wZobdcn0AlhP3VFNZFZqQ8uMnL1TiQjeyPJZ136NZNmIltYclMpyfa8YTah3wIDAQAB"
                        , "RSA2");
        return alipayClient;
    }
}